package com.talent.core.protocol.mqtt.model.entity;

import com.talent.core.protocol.mqtt.TlMqttSession;

import java.util.Objects;

/**
 * @ClassName：TlSubClient
 * @Author: hszhou
 * @Date: 2024/12/25 13:27
 * @Description: 订阅的主题对应的客户端
 */
public class TlSubClient{

    private int qos;

    private String clientId;

    private String topic;

    private TlMqttSession session;


    public TlSubClient(int qos,String clientId,String topic,TlMqttSession session){
        this.qos = qos;
        this.clientId = clientId;
        this.topic =topic;
        this.session =session;
    }


    public int getQos() {
        return qos;
    }

    public void setQos(int qos) {
        this.qos = qos;
    }

    public String getClientId() {
        return clientId;
    }

    public void setClientId(String clientId) {
        this.clientId = clientId;
    }

    public String getTopic() {
        return topic;
    }

    public void setTopic(String topic) {
        this.topic = topic;
    }

    public TlMqttSession getSession() {
        return session;
    }

    public void setCtx(TlMqttSession session) {
        this.session = session;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TlSubClient subClient = (TlSubClient) o;
        return qos == subClient.qos && Objects.equals(clientId, subClient.clientId) && Objects.equals(topic, subClient.topic) && Objects.equals(session, subClient.session);
    }

    @Override
    public int hashCode() {
        return Objects.hash(qos, clientId, topic, session);
    }
}
